package engine.newUi
{
	import engine.control.loading.MultLoader;
	import engine.ui.lite.BaseUI;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	
	import newx.StageInfo;
	import newx.com.control.NxClip;
	import newx.com.control.button.NxButton;
	import newx.com.control.group.NxViewGroup;
	
	/**
	 * 五子棋界面
	 * @author zhouqiang
	 * 
	 */	
	public class GobangUI extends BaseUI
	{
		private var control:GobangLogic;
		public var chessGroup:	NxViewGroup;
		
		public var beginBtn:NxButton;
		//public var closeBtn:NxButton;
		public var shortBtn:NxButton;
		public var chessCont:NxClip;
		
		public var blackChess:MovieClip;
		public var whiteChess:MovieClip;
		public function GobangUI(popupUI:Boolean=true)
		{
			control	=	GobangLogic.getInstance();
			super(popupUI);
		}
		
		override public function Init():void
		{
			chessGroup.addChild(blackChess);
			chessGroup.addChild(whiteChess);
			whiteChess.visible	=	false;
			blackChess.visible	=	false;
			control.Init();
		}
		override public function show(space:DisplayObjectContainer=null, onshow:Function=null, ...argc):void
		{
			if(!MultLoader.getInstance().getSourceByUrl(StageInfo.swfResPath + "chess.swf"))
			{
//				SwfLoader.StartLoad(StageInfo.swfResPath + "chess.swf",null,loadChessboardFun,[onLoading]);
				MultLoader.getInstance().load([StageInfo.swfResPath + "chess.swf"],true , createImage);
			}else
			{
				createImage();
			}
		}
		private function createImage ():void
		{
			super.show();
		}
		override protected function BeforeShow():void
		{
			control.BeforeShow();
		}
		
		override protected function AfterHide():void
		{
			control.AfterHide();
		}
	}
}